package com.rankeiot.core.job;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class MethodJob implements Runnable {
    private Object target;
    private Method method;

    public MethodJob(Object target, Method method) {
        this.target = target;
        this.method = method;
    }

    @Override
    public void run() {
        try {
            method.invoke(target);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        }
    }
}

